import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Search from '@/pages/Search'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
// 交易页
import Trade from '@/pages/Trade'
// 支付页
import Pay from '@/pages/Pay'
// 支付页面
import PaySuccess from '@/pages/PaySuccess'
export default [
    {
        path:'/home',
        component:Home,
        meta:{
            show:true
        }
    },
    {
        path:'/login',
        component:Login,
        meta:{
            show:false
        }
    },
    {
        path:'/register',
        component:Register,
        meta:{
            show:false
        }
    },
    {
        name:'search',
        path:'/search/:keyword?',
        component:Search,
        meta:{
            show:true
        },
        // 只能传递的Params
        // props:true
        // 对象的传参方式
        // props:{
        //     // 可以携带新的参数传递
        // }
        // 函数的传参方式
        props:(route)=>({keyWord:route.params.keyWord,k:route.query.k})
    },
    {
        path:'/',
        redirect:'/home'
    },
    {
        path:'/detail/:skuId',
        component:Detail,
        meta:{
            show:true
        }
    },
    {
        path:'/addcartsuccess',
        component:AddCartSuccess,
        meta:{show:true},
        name:"addcartsuccess"
     },
     {
        path:'/shopcart',
        component:ShopCart,
        meta:{show:true}
    },
    // 交易页路由
    {
        path:'/trade',
        component:Trade,
        meta:{show:true}
    },
    // 提交订单支付页
    {
        path:'/pay',
        component:Pay,
        // 路由元信息
        meta:{show:true}
    },
    // 查看支付陈成功的页面
    {
        path:'/paysuccess',
        component:PaySuccess,
        meta:{show:true}
    }

]